package com.zjitc.controller;

import com.zjitc.common.ServerResponse;
import com.zjitc.service.UserService;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/4/2 16:40
 * @description:
 */
@Controller
@RequestMapping("/manager/user")
public class UserManagerController {
  @Autowired
  private UserService userService;

  @RequestMapping("login.do")
  @ResponseBody
  public ServerResponse login(HttpSession session,String username,String password){
    ServerResponse serverResponse=userService.login(username,password);
    if (serverResponse.getStatus() == 1) {
      return serverResponse;
    }
    session.setAttribute("user", serverResponse.getData());
    return serverResponse;
  }


  @RequestMapping("list.do")
  @ResponseBody
  public void list(Integer pageNum,Integer pageSize){

  }
}
